Device Searching Method and Electronic Device

ABSTRACT

A device searching method includes: a first device obtains a relative location between a second device and the first device based on location information of the first device and the location information of the second device; if it is determined, based on the relative location, that the second device is not within a shooting range of the first device, the first device indicates to move the first device toward the second device until the second device is within the shooting range of the first device; and the first device highlights the area in which the second device is located in the shooting range of the first device.

CROSS-REFERENCE TO RELATED APPLICATIONS

This is a continuation of International Patent Application No.PCT/CN2021/081517 filed on Mar. 18, 2021, which claims priority toChinese Patent Application No. 202010779683.0 filed on Aug. 5, 2020. Thedisclosures of the aforementioned applications are hereby incorporatedby reference in their entireties.

TECHNICAL FIELD

This application relates to the artificial intelligence field, and inparticular, to a device searching method and an electronic device.

BACKGROUND

Usually, in some scenarios, a case in which a user loses or forgets adevice may occur. Usually, when a device A, that is, a lost or forgottendevice, is in a power-on state and has a function such as Bluetooth orWi-Fi, the device A may be connected by using a function such asBluetooth or Wi-Fi of another device. After the device A is connected toan external device or a cloud server, the external device or the cloudserver connected to the device A sends an instruction to the forgottendevice, so that the device A produces a prompt tone or vibrates. In thisway, a user can find the device A. However, the device A needs to have avibration function and a sounding function, and needs to be in thepower-on state.

SUMMARY

This disclosure provides a device searching method and an electronicdevice, to label a location of a to-be-searched device in an image basedon localization of the to-be-searched device and a shot image. In thisway, a user can quickly find a device in an actual application scenario,thereby improving user experience.

In view of this, according to a first aspect, this disclosure provides adevice searching method, including: A first device obtains locationinformation of a second device; the first device obtains a relativelocation between the second device and the first device based onlocation information of the first device and the location information ofthe second device; if it is determined, based on the relative location,that the second device is within a shooting range of the first device,the first device shoots a first image; the first device determines anarea in which the second device is located in the first image; and thefirst device highlights the area in which the second device is locatedin the first image.

Therefore, in this implementation of this disclosure, in a devicesearching process, the relative location between the first device andthe second device may be obtained. If the first device has a shootingfunction, and the second device is within the shooting range of thefirst device, an area in which the second device is located may belabeled in a shot image, so that a user can intuitively view a locationof the second device. In this way, the user can quickly find a lostdevice, thereby improving user experience.

In a possible implementation, the first device further displays theentire first image or a part of the first image. Therefore, the user canquickly find the second device by referring to the entire first image orthe part of the first image.

In a possible implementation, the method may further include: The firstdevice performs prompting based on the relative location between thesecond device and the first device.

Therefore, in this implementation of this disclosure, prompting may befurther performed based on the relative location between the seconddevice and the first device, so that the user can more accurately find alocation of the second device in an actual application scenario based onthe relative location. Alternatively, when the first device does nothave the shooting function, prompting may be directly performed on adirection and/or a distance of the second device relative to the firstdevice, so that the user can quickly find the lost second device basedon prompting, thereby improving user experience.

In a possible implementation, the relative location includes a firstdistance between the first device and the second device and a firstdirection of the second device relative to the first device. That thefirst device performs prompting based on the relative location betweenthe second device and the first device may include: The first deviceperforms prompting on at least one of the first distance and the firstdirection.

In this implementation of this disclosure, the first device may performprompting on the distance and the direction of the second devicerelative to the first device, so that the user can intuitively find thesecond device based on the distance and the direction of the seconddevice relative to the first device, thereby improving user experience.

In a possible implementation, that the first device performs promptingon at least one of the first distance and the first direction mayinclude: The first device displays at least one of the first distanceand the first direction in a display interface; or the first deviceplays voice guidance, where the voice guidance includes a voice of atleast one of the first distance and the first direction.

Therefore, in this implementation of this disclosure, prompting may beperformed in the display interface or prompting may be performed in avoice play manner, to flexibly adapt to different scenarios, so that theuser can accurately find the second device based on prompting, therebyimproving user experience.

In a possible implementation, if the second device is not within theshooting range of the first device, the method may further include: Thefirst device indicates to move the first device toward the seconddevice, until the second device is within the shooting range of thefirst device.

In this implementation of this disclosure, if the first device has theshooting function, and the second device is not within the shootingrange of the first device, prompting may be performed to move the firstdevice, so that the second device is within the shooting range of thefirst device and the area in which the second device is located islabeled in the shot image. In this way, the user can intuitively viewthe location of the second device, so that the user can quickly find thelost device, thereby improving user experience.

In a possible implementation, after the first device indicates to movethe first device toward the second device, the method may furtherinclude: If the first device detects that the first device moves, thefirst device updates the relative location between the first device andthe second device based on real-time location information of the firstdevice, and indicates an updated relative location.

In this implementation of this disclosure, when the first device moves,the relative location between the first device and the second device maybe updated in real time. Optionally, prompting may be further performedbased on the updated relative location, so that the user can obtain alocation change of the second device in time when the first devicemoves. In this way, the user can find the second device in time, therebyimproving user experience.

In a possible implementation, if the second device is within theshooting range of the first device, and the second device is shielded byan obstacle within the shooting range, that the first device determinesan area in which the second device is located in the first image mayinclude: The first device calculates, based on the relative location, anarea in which the shielded second device is located in the first image.

In this implementation of this disclosure, even if the second device isshielded, the area of the second device in the first image may also becalculated based on the relative location, so that the user can find thesecond device in time, thereby improving user experience.

In a possible implementation, that a first device obtains locationinformation of a second device may include: The first device establishesa communication connection to the second device; and the first devicereceives the location information sent by the second device.

In this implementation of this disclosure, the first device mayestablish a communication connection to the second device, to directlyreceive the location information sent by the second device.

In a possible implementation, that a first device obtains locationinformation of a second device may include: The first device establishesa communication connection to a third device; and the first devicereceives the location information of the second device sent by the thirddevice, where the location information is sent to the third device bythe second device.

In this implementation of this disclosure, the first device may obtainthe location information of the second device by using the third device.Even if the first device does not establish a connection to the seconddevice, the first device can still obtain the location information ofthe second device, so that prompting can be subsequently performed onthe area in which the second device is located in the image. In thisway, the user can quickly find the second device, thereby improving userexperience.

In a possible implementation, before the first device determines thearea in which the second device is located in the first image, themethod further includes: The first device obtains a device attribute ofthe second device, where the device attribute includes a type or anappearance of the second device.

In this implementation of this disclosure, the first device may obtainthe device attribute of the second device, for example a device type orappearance, so that the second device can be accurately identified inthe first image, and the area in which the second device is located canbe highlighted more accurately in the image. In this way, the user canquickly find the second device, thereby improving user experience.

According to a second aspect, this disclosure provides an electronicdevice, including: an obtaining module, configured to obtain locationinformation of a second device; a calculation module, configured toobtain a relative location between the second device and the electronicdevice based on location information of the electronic device and thelocation information of the second device; a shooting module, configuredto: if it is determined, based on the relative location, that the seconddevice is within a shooting range of the electronic device, shoot afirst image; a determining module, configured to determine, by using theelectronic device, an area in which the second device is located in thefirst image; and a prompting module, configured to highlight the area inwhich the second device is located in the first image.

In a possible implementation, the prompting module is further configuredto perform prompting based on the relative location between the seconddevice and the electronic device.

In a possible implementation, the relative location includes a firstdistance between the electronic device and the second device and a firstdirection of the second device relative to the electronic device. Theprompting module is specifically configured to perform, by using theelectronic device, prompting on at least one of the first distance andthe first direction.

In a possible implementation, the prompting module is specificallyconfigured to: display at least one of the first distance and the firstdirection in a display interface; or play voice guidance, where thevoice guidance includes a voice of at least one of the first distanceand the first direction.

In a possible implementation, the prompting module is further configuredto: if the second device is not within the shooting range of theelectronic device, indicate to move the electronic device toward thesecond device, until the second device is within the shooting range ofthe electronic device.

In a possible implementation, the calculation module is furtherconfigured to: if it is detected that the electronic device moves,update the relative location between the electronic device and thesecond device based on real-time location information of the electronicdevice, to obtain an updated relative location.

The prompting module is further configured to indicate the updatedrelative location, that is, perform prompting on the updated relativelocation.

In a possible implementation, if the second device is within theshooting range of the electronic device, and the second device isshielded by an obstacle within the shooting range, the determiningmodule is further configured to calculate, based on the relativelocation, an area in which the shielded second device is located in thefirst image.

In a possible implementation, the electronic device further includes atransceiver module, configured to: establish a communication connectionto the second device, and receive the location information sent by thesecond device.

In a possible implementation, the transceiver module is furtherconfigured to: establish a communication connection to a third device,and receive the location information of the second device sent by thethird device.

In a possible implementation, before the determining module determinesthe area in which the second device is located in the first image, thetransceiver module is further configured to obtain a device attribute ofthe second device, where the device attribute of the second deviceincludes a type or an appearance of the second device.

According to a third aspect, this disclosure provides an electronicdevice, including: a processor, configured to: obtain locationinformation of a second device, and obtain a relative location betweenthe second device and the electronic device based on the locationinformation of the second device, where the processor is furtherconfigured to: if it is determined, based on the relative location, thatthe second device is within a shooting range of a camera of theelectronic device, indicate the camera to shoot a first image, anddetermine an area in which the second device is located in the firstimage; and a display, configured to highlight the area in which thesecond device is located in the first image.

In a possible implementation, the processor is further configured toindicate to perform prompting based on the relative location between thesecond device and the electronic device.

In a possible implementation, the relative location includes a firstdistance between the electronic device and the second device and a firstdirection of the second device relative to the electronic device.

The processor is specifically configured to indicate to performprompting on at least one of the first distance and the first direction.

In a possible implementation, the display is further configured todisplay at least one of the first distance and the first direction underindication of the processor; or the electronic device further includes aspeaker, configured to play voice guidance under indication of theprocessor, where the voice guidance includes a voice of at least one ofthe first distance and the first direction.

In a possible implementation, the processor is further configured to: ifthe second device is not within the shooting range of the electronicdevice, indicate to move the electronic device toward the second device,until the second device is within the shooting range of the electronicdevice; and the display is further configured to display, underindication of the processor, prompting information indicating to movethe electronic device toward the second device, until the second deviceis within the shooting range of the electronic device, or the electronicdevice further includes a speaker, configured to play, under indicationof the processor, prompting information indicating to move theelectronic device toward the second device, until the second device iswithin the shooting range of the electronic device.

In a possible implementation, the processor is further configured to: ifdetecting that the electronic device moves, update the relative locationbetween the electronic device and the second device based on real-timelocation information of the electronic device, to obtain an updatedrelative location; and the display is further configured to display theupdated relative location, or the speaker is further configured to playa voice including the updated relative location.

In a possible implementation, if the second device is within theshooting range of the electronic device, and the second device isshielded by an obstacle within the shooting range, the processor isfurther configured to calculate, based on the relative location, an areain which the shielded second device is located in the first image.

In a possible implementation, the electronic device further includes atransceiver, configured to: establish a communication connection to thesecond device, and receive the location information sent by the seconddevice.

In a possible implementation, the transceiver is further configured to:establish a communication connection to a third device, and receive thelocation information of the second device sent by the third device.

In a possible implementation, before the processor determines the areain which the second device is located in the first image, thetransceiver is further configured to obtain a device attribute of thesecond device, where the device attribute of the second device includesa type or an appearance of the second device.

According to a fourth aspect, this disclosure provides an electronicdevice. The electronic device includes a display, a memory, and one ormore processors, where the memory stores code of a graphical userinterface of an application, and the one or more processors areconfigured to execute the code of the graphical user interface (GUI)stored in the memory, to display the graphical user interface in thedisplay; and the graphical user interface is configured to: displayinformation about a to-be-searched second device in the display; andhighlight, based on an obtained first image and in the display, an areain which the second device is located in the first image, where thefirst image is obtained as follows: in response to an operation on thesecond device, obtaining location information of the second device, andobtaining a relative location between the second device and theelectronic device based on the location information of the seconddevice; and if it is determined, based on the relative location, thatthe second device is within a shooting range of the electronic device,shooting the first image.

In a possible implementation, the GUI is further configured to displaythe relative location in the display.

In a possible implementation, the relative location includes a firstdistance between the electronic device and the second device and a firstdirection of the second device relative to the electronic device. TheGUI is specifically configured to display at least one of the firstdistance and the first direction in the display.

In a possible implementation, if the second device is not within theshooting range of the electronic device, the GUI is further configuredto: display, in the display, prompting information indicating to movethe electronic device toward the second device, until the second deviceis within the shooting range of the electronic device.

In a possible implementation, after the electronic device performsprompting based on the relative location between the second device andthe electronic device, if the one or more processors detect that theelectronic device moves, the one or more processors update the relativelocation between the electronic device and the second device based onreal-time location information of the electronic device, to obtain anupdated relative location. The GUI is further configured to display theupdated relative location in the display.

According to a fifth aspect, an embodiment of this disclosure providesan electronic device, including a processor and a memory. The processorand the memory are interconnected through a line, and the processorinvokes program code in the memory, to perform a processing-relatedfunction in the device searching method in any one of the first aspector the possible implementations of the first aspect. Optionally, theelectronic device may be a chip.

According to a sixth aspect, an embodiment of this disclosure providesan electronic device. The electronic device may also be referred to as adigital processing chip or a chip. The chip includes a processing unitand a communication interface. The processing unit obtains programinstructions through the communication interface, and the programinstructions are executed by the processing unit, so that the processingunit is configured to perform a processing-related function in any oneof the first aspect or the possible implementations of the first aspect.

According to a seventh aspect, an embodiment of this disclosure providesa computer-readable storage medium, including instructions. When theinstructions are run on a computer, the computer is enabled to performthe method in any one of the first aspect or the possibleimplementations of the first aspect.

According to an eighth aspect, an embodiment of this disclosure providesa computer program product including instructions. When the computerprogram product runs on a computer, the computer is enabled to performthe method in any one of the first aspect or the possibleimplementations of the first aspect.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a schematic diagram of a network architecture according tothis disclosure;

FIG. 2 is a schematic diagram of a structure of an electronic deviceaccording to this disclosure;

FIG. 3 is a schematic diagram of a structure of another electronicdevice according to this disclosure;

FIG. 4 is a schematic flowchart of a device searching method accordingto this disclosure;

FIG. 5 is a schematic diagram of a shooting range according to thisdisclosure;

FIG. 6A and FIG. 6B are a schematic flowchart of another devicesearching method according to this disclosure;

FIG. 7 is a schematic transmission diagram of location informationaccording to this disclosure;

FIG. 8 is another schematic transmission diagram of location informationaccording to this disclosure;

FIG. 9 is another schematic transmission diagram of location informationaccording to this disclosure;

FIG. 10 is a schematic diagram of a GUI according to this disclosure;

FIG. 11 is a schematic diagram of another GUI according to thisdisclosure;

FIG. 12 is a schematic diagram of another GUI according to thisdisclosure;

FIG. 13A is a schematic diagram of another GUI according to thisdisclosure;

FIG. 13B is a schematic diagram of another GUI according to thisdisclosure;

FIG. 14 is a schematic diagram of a voice prompting manner according tothis disclosure;

FIG. 15 is a schematic diagram of a coordinate system according to thisdisclosure;

FIG. 16A is a schematic diagram of another GUI according to thisdisclosure;

FIG. 16B is a schematic diagram of another GUI according to thisdisclosure;

FIG. 17 is a schematic diagram of another GUI according to thisdisclosure;

FIG. 18A is a schematic diagram of another GUI according to thisdisclosure;

FIG. 18B is a schematic diagram of another GUI according to thisdisclosure;

FIG. 19 is a schematic diagram of another GUI according to thisdisclosure;

FIG. 20 is a schematic diagram of another GUI according to thisdisclosure;

FIG. 21 is a schematic diagram of a structure of another electronicdevice according to this disclosure;

FIG. 22 is a schematic diagram of a structure of another electronicdevice according to this disclosure; and

FIG. 23 is a schematic diagram of a structure of a chip according tothis disclosure.

DESCRIPTION OF EMBODIMENTS

The following describes the technical solutions in embodiments of thisdisclosure with reference to the accompanying drawings in embodiments ofthis disclosure. It is clear that the described embodiments are merelysome but not all of the embodiments of this disclosure. All otherembodiments obtained by a person skilled in the art based on embodimentsof this disclosure without creative efforts shall fall within theprotection scope of this disclosure.

First, for a network architecture applied to a device searching methodprovided in this disclosure, refer to FIG. 1. The network architectureincludes a plurality of electronic devices (for example, a device 1 to adevice N shown in FIG. 1), and the electronic devices may be connectedto each other.

The electronic device in this disclosure may include but is not limitedto: an intelligent mobile phone, a television, a tablet computer, awristband, a head-mounted display device (HMD), an augmented reality(AR) device, a mixed reality (MR) device, a cellular phone, asmartphone, a personal digital assistant (PDA), an in-vehicle terminal,a laptop computer, a personal computer (PC), and the like. Certainly, inthe following embodiments, specific forms of these electronic devicesare not limited. It may be understood that, the first device, the seconddevice, the third device, or the like mentioned in the followingimplementations of this disclosure may be any electronic device in theforegoing.

The plurality of electronic devices may establish a connection by usinga wireless network or a wired network. The wireless network includes butis not limited to any one or more of a 5th-generation mobilecommunication technology (5G) system, a long term evolution (LTE)system, a global system for mobile communications (GSM), a code divisionmultiple access (CDMA) network, a wideband code division multiple access(WCDMA) network, wireless fidelity (Wi-Fi), Bluetooth, ZigBee, a radiofrequency identification (RFID) technology, long range (Lora) wirelesscommunication, and near-field communication (NFC).

In the network architecture shown in FIG. 1, data may be mutuallytransmitted among the electronic devices directly or based on anestablished communication connection. For example, location informationof each electronic device is transmitted to all devices or a specifiedelectronic device in the network architecture directly or through theestablished communication connection.

It should be understood that, in the network architecture shown in FIG.1, one of the electronic devices may be selected as a management device,to manage the devices in the network architecture, for example, to addan operation such as verification, online status statistics, locationstatistics, bandwidth allocation, or traffic statistics. Certainly,alternatively, there may be no management device, and the electronicdevices may establish a connection, so that information about anotherdevice, for example, location information and a device attribute (suchas a device type or a device appearance), is directly or indirectlyobtained from the network architecture through an establishedconnection.

For example, refer to FIG. 2. The following uses a specific structure asan example to describe a structure of an electronic device provided inthis disclosure.

The electronic device 100 may include a processor 110, an externalmemory interface 120, an internal memory 121, a Universal Serial Bus(USB) interface 130, a charging management module 140, a powermanagement module 141, a battery 142, an antenna 1, an antenna 2, amobile communication module 150, a wireless communication module 160, anaudio module 170, a speaker 170A, a receiver 170B, a microphone 170C, aheadset jack 170D, a sensor module 180, a button 190, a motor 191, anindicator 192, a camera 193, a display 194, a subscriber identity module(SIM) card interface 195, and the like. The sensor module 180 mayinclude a pressure sensor 180A, a gyro sensor 180B, a barometricpressure sensor 180C, a magnetic sensor 180D, an acceleration sensor180E, a distance sensor 180F, an optical proximity sensor 180G, afingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K,an ambient light sensor 180L, a bone conduction sensor 180M, a motionsensor 180N, and the like.

It may be understood that the structure shown in embodiments does notconstitute a specific limitation on the electronic device 100. In otherembodiments of this disclosure, the electronic device 100 may includemore or fewer components than those shown in the figure, combine somecomponents, split some components, or have different componentarrangements. The components shown in the figure may be implemented byhardware, software, or a combination of software and hardware.

The processor 110 may include one or more processing units. For example,the processor 110 may include an application processor (AP), a modemprocessor, a graphics processing unit (GPU), an image signal processor(ISP), a controller, a video codec, a digital signal processor (DSP), abaseband processor, and/or a neural network processing unit (NPU).Different processing units may be independent components, or may beintegrated into one or more processors.

The controller may generate an operation control signal based oninstruction operation code and a time sequence signal, to completecontrol of instruction fetching and instruction execution.

A memory may be further disposed in the processor 110, and is configuredto store instructions and data. In some embodiments, the memory in theprocessor 110 is a cache. The memory may store instructions or data justused or cyclically used by the processor 110. If the processor 110 needsto use the instructions or the data again, the processor 110 maydirectly invoke the instructions or the data from the memory, to avoidrepeated access and reduce waiting time of the processor 110, therebyimproving system efficiency.

In some embodiments, the processor 110 may include one or moreinterfaces. The interface may include an inter-integrated circuit (I2C)interface, an inter-integrated circuit sound (I2S) interface, apulse-code modulation (PCM) interface, a universal asynchronousreceiver/transmitter (UART) interface, a mobile industry processorinterface (MIPI), a general-purpose input/output (GPIO) interface, asubscriber identity module (SIM) interface, a universal serial bus (USB)interface, and/or the like.

The I2C interface is a two-way synchronization serial bus, and includesone serial data line (SDA) and one serial clock line (SCL). In someembodiments, the processor 110 may include a plurality of groups of I2Cbuses. The processor 110 may be separately coupled to the touch sensor180K, a charger, a flashlight, the camera 193, and the like throughdifferent I2C bus interfaces. For example, the processor 110 may becoupled to the touch sensor 180K through an I2C interface, so that theprocessor 110 communicates with the touch sensor 180K through the I2Cbus interface, to implement a touch function of the electronic device100.

The I2S interface may be configured to perform audio communication. Insome embodiments, the processor 110 may include a plurality of groups ofI2S buses. The processor 110 may be coupled to the audio module 170through the I2S bus, to implement communication between the processor110 and the audio module 170. In some embodiments, the audio module 170may transmit an audio signal to the wireless communication module 160through the I2S interface, to implement a function of answering a callthrough a Bluetooth headset.

The PCM interface may also be configured to: perform audiocommunication, and sample, quantize, and code an analog signal. In someembodiments, the audio module 170 may be coupled to the wirelesscommunication module 160 through a PCM bus interface. In someembodiments, the audio module 170 may alternatively transmit an audiosignal to the wireless communication module 160 through the PCMinterface, to implement a function of answering a call through aBluetooth headset. Both the I2S interface and the PCM interface may beconfigured to perform audio communication.

The UART interface is a universal serial data bus, and is configured toperform asynchronous communication. The bus may be a two-waycommunication bus, and converts to-be-transmitted data between serialcommunication and parallel communication. In some embodiments, the UARTinterface is usually configured to connect the processor 110 to thewireless communication module 160. For example, the processor 110communicates with a Bluetooth module in the wireless communicationmodule 160 through the UART interface, to implement a Bluetoothfunction. In some embodiments, the audio module 170 may transmit anaudio signal to the wireless communication module 160 through the UARTinterface, to implement a function of playing music through theBluetooth headset.

The MIPI interface may be configured to connect the processor 110 to aperipheral component, for example, the display 194 or the camera 193.The MIPI interface includes a camera serial interface (CSI), a displayserial interface (DSI), or the like. In some embodiments, the processor110 communicates with the camera 193 through the CSI interface, toimplement a shooting function of the electronic device 100. Theprocessor 110 communicates with the display 194 through the DSIinterface, to implement a display function of the electronic device 100.

The GPIO interface may be configured by using software. The GPIOinterface may be configured as a control signal, or may be configured asa data signal. In some embodiments, the GPIO interface may be configuredto connect the processor 110 to the camera 193, the display 194, thewireless communication module 160, the audio module 170, the sensormodule 180, or the like. The GPIO interface may be further configured asthe I2C interface, the I2S interface, the UART interface, the MIPIinterface, or the like.

The USB interface 130 is an interface that conforms to a USB standardspecification, and may be specifically a mini USB interface, a micro USBinterface, a USB Type-C interface, or the like. The USB interface 130may be used to connect to a charger for charging the electronic device100, may be used to transmit data between the electronic device 100 anda peripheral device, and may also be configured to connect to a headsetto play audio through the headset. In addition, the port may be furtherused to connect to another electronic device, for example, an AR device.It should be understood that, the USB interface 130 herein may also bereplaced with another interface, for example, an interface that mayimplement charging or data transmission, such as a type-c interface or alighting interface. The USB interface 130 herein is merely used as anexample for description.

It may be understood that an interface connection relationship betweenthe modules that is shown in this embodiment is merely an example fordescription, and does not constitute a limitation on the structure ofthe electronic device 100. In other embodiments of this disclosure, theelectronic device 100 may alternatively use an interface connection modedifferent from that in the foregoing embodiment, or use a combination ofa plurality of interface connection modes.

The charging management module 140 is configured to receive a charginginput from the charger. The charger may be a wireless charger or a wiredcharger. In some embodiments of wired charging, the charging managementmodule 140 may receive a charging input of the wired charger through theUSB interface 130. In some embodiments of wireless charging, thecharging management module 140 may receive a wireless charging inputthrough a wireless charging coil of the electronic device 100. Thecharging management module 140 may further supply power to theelectronic device by using the power management module 141 whilecharging the battery 142.

The power management module 141 is configured to connect to the battery142, the charging management module 140, and the processor 110. Thepower management module 141 receives an input of the battery 142 and/oran input of the charging management module 140, and supplies power tothe processor 110, the internal memory 121, the display 194, the camera193, the wireless communication module 160, and the like. The powermanagement module 141 may be further configured to monitor parameterssuch as a battery capacity, a battery cycle count, and a battery healthstatus (electric leakage or impedance). In some other embodiments, thepower management module 141 may alternatively be disposed in theprocessor 110. In some other embodiments, the power management module141 and the charging management module 140 may alternatively be disposedin a same device.

A wireless communication function of the electronic device 100 may beimplemented through the antenna 1, the antenna 2, the mobilecommunication module 150, the wireless communication module 160, themodem processor, the baseband processor, and the like.

The antenna 1 and the antenna 2 are configured to transmit and receiveelectromagnetic wave signals. Each antenna in the electronic device 100may be configured to cover one or more communication bands. Differentantennas may be further reused, to improve antenna utilization. Forexample, the antenna 1 may be reused as a diversity antenna in awireless local area network. In some other embodiments, an antenna maybe used in combination with a tuning switch.

The mobile communication module 150 may provide a wireless communicationsolution that includes 2G/3G/4G/5G and the like and that is applied tothe electronic device 100. The mobile communication module 150 mayinclude at least one filter, a switch, a power amplifier, a low-noiseamplifier (LNA), and the like. The mobile communication module 150 mayreceive an electromagnetic wave through the antenna 1, performprocessing such as filtering and amplification on the receivedelectromagnetic wave, and transfer a processed electromagnetic wave tothe modem processor for demodulation. The mobile communication module150 may further amplify a signal modulated by the modem processor, andconvert an amplified signal into an electromagnetic wave for radiationthrough the antenna 1. In some embodiments, at least some functionmodules in the mobile communication module 150 may be disposed in theprocessor 110. In some embodiments, at least some function modules inthe mobile communication module 150 and at least some modules in theprocessor 110 may be disposed in a same device.

The modem processor may include a modulator and a demodulator. Themodulator is configured to modulate a to-be-sent low frequency basebandsignal into a medium and high frequency signal. The demodulator isconfigured to demodulate a received electromagnetic wave signal into alow frequency baseband signal. Then, the demodulator transmits the lowfrequency baseband signal obtained through demodulation to the basebandprocessor for processing. The baseband processor processes thelow-frequency baseband signal, and then transfers a processed signal tothe application processor. The application processor outputs a soundsignal through an audio device (which is not limited to the speaker170A, the receiver 170B, or the like), or displays an image or a videothrough the display 194. In some embodiments, the modem processor may bean independent device. In some other embodiments, the modem processormay be independent of the processor 110, and is disposed in the samedevice as the mobile communication module 150 or another functionmodule.

The wireless communication module 160 may provide a wirelesscommunication solution that includes a wireless local area network(WLAN) (for example, a Wi-Fi network), Bluetooth (BT), a globalnavigation satellite system (GNSS), frequency modulation (FM), antechnology, ultra wideband (UWB), an infrared (IR) technology, or thelike and that is applied to the electronic device 100. The wirelesscommunication module 160 may be one or more components that integrate atleast one communication processing module. The wireless communicationmodule 160 receives an electromagnetic wave through the antenna 2,performs frequency modulation and filtering processing on theelectromagnetic wave signal, and sends a processed signal to theprocessor 110. The wireless communication module 160 may further receivea to-be-sent signal from the processor 110, perform frequency modulationand amplification on the signal, and convert an amplified signal into anelectromagnetic wave for radiation through the antenna 2.

In some embodiments, in the electronic device 100, the antenna 1 and themobile communication module 150 are coupled, and the antenna 2 and thewireless communication module 160 are coupled, so that the electronicdevice 100 can communicate with a network and another device by using awireless communication technology. The wireless communication technologymay include but is not limited to: a 5th-generation mobile communicationtechnology (5G) system, a Global System for Mobile Communications (GSM),a general packet radio service (GPRS), code-division multiple access(CDMA), wideband code-division multiple access (WCDMA), time-divisionsynchronous code-division multiple access (TD-SCDMA), Long-TermEvolution (LTE), Bluetooth, a global navigation satellite system (GNSS),Wi-Fi, NFC, FM, Zigbee, a radio frequency identification (RFID)technology, an infrared (IR) technology, and/or the like. The GNSS mayinclude a global positioning system (GPS), a global navigation satellitesystem (GLONASS), a Beidou navigation satellite system (BDS), aquasi-zenith satellite system (QZSS), and/or a satellite basedaugmentation system (SBAS).

In some implementations, the electronic device 100 may also include awired communication module (which is not shown in FIG. 1), or the mobilecommunication module 150 or the wireless communication module 160 hereinmay be replaced with a wired communication module (which is not shown inFIG. 1). The wired communication module may enable the electronic deviceto communicate with another device by using a wired network. The wirednetwork may include but is not limited to one or more of the following:an optical transport network (OTN), a synchronous digital hierarchy(SDH), a passive optical network (PON), Ethernet, Flexible Ethernet(FlexE), or the like.

The electronic device 100 implements a display function by using theGPU, the display 194, the application processor, and the like. The GPUis a microprocessor for image processing, and is connected to thedisplay 194 and the application processor. The GPU is configured toperform mathematical and geometric calculation, and render an image. Theprocessor 110 may include one or more GPUs that execute programinstructions to generate or change display information.

The display 194 is configured to display an image, a video, and thelike. The display 194 includes a display panel. The display panel may bea liquid-crystal display (LCD), an organic light-emitting diode (OLED),an active-matrix organic light-emitting diode (AMOLED), a flexlight-emitting diode (FLED), a mini-LED, a micro-LED, a micro-OLED, aquantum dot light-emitting diode (QLED), or the like. In someembodiments, the electronic device 100 may include one or N displays194, where N is a positive integer greater than 1.

The electronic device 100 can implement a shooting function by using theISP, the camera 193, the video codec, the GPU, the display 194, theapplication processor, and the like.

The ISP is configured to process data fed back by the camera 193. Forexample, during shooting, a shutter is pressed, light is transmitted toa photosensitive element of the camera through a lens, an optical signalis converted into an electrical signal, and the photosensitive elementof the camera transmits the electrical signal to the ISP for processing,to convert a processed electrical signal into a visible image. The ISPmay further perform algorithm optimization on noise, brightness, andcomplexion of the image. The ISP may further optimize parameters such asexposure and a color temperature of a shooting scenario. In someembodiments, the ISP may be disposed in the camera 193.

The camera 193 is configured to capture a static image or a video. Anoptical image of an object is generated through the lens, and isprojected onto the photosensitive element. The photosensitive elementmay be a charge coupled device (CCD) or a complementarymetal-oxide-semiconductor (CMOS) phototransistor. The photosensitiveelement converts an optical signal into an electrical signal, and thentransmits the electrical signal to the ISP for converting the electricalsignal into a digital image signal. The ISP outputs the digital imagesignal to the DSP for processing. The DSP converts the digital imagesignal into an image signal in a standard format, for example, RGB orYUV. In some embodiments, the electronic device 100 may include one or Ncameras 193, where N is a positive integer greater than 1.

The digital signal processor is configured to process a digital signal,and may process another digital signal in addition to the digital imagesignal. For example, when the electronic device 100 selects a frequency,the digital signal processor is configured to perform Fouriertransformation and the like on frequency energy.

The video codec is configured to compress or decompress a digital video.The electronic device 100 may support one or more video codecs.Therefore, the electronic device 100 may play or record videos in aplurality of coding formats, for example, Moving Picture Experts Group(MPEG)-1, MPEG-2, MPEG-3, and MPEG-4.

The NPU is a neural network (NN) computing processor that rapidlyprocesses input information by referring to a structure of a biologicalneural network, for example, by referring to a transfer mode betweenhuman brain neurons, and can further perform self-learning continuously.The NPU can implement applications such as intelligent cognition of theelectronic device 100, such as image recognition, facial recognition,speech recognition, and text understanding.

The external memory interface 120 may be configured to connect to anexternal memory card, for example, a micro SD card, to extend a storagecapability of the electronic device 100. The external storage cardcommunicates with the processor 110 through the external memoryinterface 120, to implement a data storage function. For example, filessuch as music and videos are stored in the external storage card.

The internal memory 121 may be configured to store computer-executableprogram code. The executable program code includes instructions. Theinternal memory 121 may include a program storage area and a datastorage area. The program storage area may store an operating system, anapplication required by at least one function (for example, a soundplaying function or an image playing function), and the like. The datastorage area may store data (for example, audio data, and an addressbook) created in a process of using the electronic device 100, and thelike. In addition, the internal memory 121 may include a high-speedrandom access memory, and may further include a nonvolatile memory, forexample, at least one magnetic disk storage device, a flash memory, or auniversal flash storage (UFS). The processor 110 runs the instructionsstored in the internal memory 121 and/or the instructions stored in thememory disposed in the processor, to perform various functionapplications of the electronic device 100 and process data.

The electronic device 100 may implement an audio function such as musicplaying or recording by using the audio module 170, the speaker 170A,the receiver 170B, the microphone 170C, the headset jack 170D, theapplication processor, and the like.

The audio module 170 is configured to convert digital audio informationinto an analog audio signal output, and is also configured to convert ananalog audio input into a digital audio signal. The audio module 170 maybe further configured to encode and decode an audio signal. In someembodiments, the audio module 170 may be disposed in the processor 110,or some functional modules of the audio module 170 are disposed in theprocessor 110.

The speaker 170A, also referred to as a “loudspeaker”, is configured toconvert an audio electrical signal into a sound signal. The electronicdevice 100 may be used to listen to music or answer a call in ahands-free mode over the speaker 170A.

The receiver 170B, also referred to as an “earpiece”, is configured toconvert an audio electrical signal into a sound signal. When a call isanswered or audio information is listened to by using the electronicdevice 100, the receiver 170B may be put close to a human ear to listento a voice.

The microphone 170C, also referred to as a “mike” or a “microphone”, isconfigured to convert a sound signal into an electrical signal. Whenmaking a call or sending voice information, a user may make a sound bymoving the mouth close to the microphone 170C to input a sound signal tothe microphone 170C. At least one microphone 170C may be disposed in theelectronic device 100. In some other embodiments, two microphones 170Cmay be disposed in the electronic device 100, to collect a sound signaland implement a noise reduction function. In some other embodiments,three, four, or more microphones 170C may alternatively be disposed inthe electronic device 100, to collect a sound signal, implement noisereduction, and identify a sound source, so as to implement a directionalrecording function and the like.

The headset jack 170D is configured to connect to a wired headset. Theheadset jack 170D may be a USB interface 130, or may be a 3.5 mm openmobile terminal platform (OMTP) standard interface or cellulartelecommunications industry association of the USA (CTIA) standardinterface.

The pressure sensor 180A is configured to sense a pressure signal, andcan convert the pressure signal into an electrical signal. In someembodiments, the pressure sensor 180A may be disposed on the display194. There are many types of pressure sensors 180A, such as a resistivepressure sensor, an inductive pressure sensor, and a capacitive pressuresensor. The capacitive pressure sensor may include at least two parallelplates made of conductive materials. When a force is applied to thepressure sensor 180A, capacitance between electrodes changes. Theelectronic device 100 determines pressure intensity based on acapacitance change. When a touch operation is performed on the display194, the electronic device 100 detects intensity of the touch operationby using the pressure sensor 180A. The electronic device 100 maycalculate a touch location based on a detection signal of the pressuresensor 180A. In some embodiments, touch operations that are performed ata same touch location but have different touch operation intensity maycorrespond to different operation instructions. For example, when atouch operation whose touch operation intensity is less than a firstpressure threshold is performed on an application icon “Messages”, aninstruction for viewing an SMS message is executed. When a touchoperation whose touch operation intensity is greater than or equal tothe first pressure threshold is performed on an application icon“Messages”, an instruction for creating an SMS message is executed.

The gyroscope sensor 180B may be configured to determine a motionposture of the electronic device 100. In some embodiments, an angularvelocity of the electronic device 100 around three axes (namely, axes X,Y, and Z) may be determined by using the gyroscope sensor 180B. Thegyroscope sensor 180B may be configured to implement image stabilizationduring shooting. For example, when a shutter is pressed, the gyroscopesensor 180B detects an angle at which the electronic device 100 jitters,obtains, through calculation based on the angle, a distance for which alens module needs to compensate, and allows the lens to cancel out thejitter of the electronic device 100 through reverse motion, to implementimage stabilization. The gyroscope sensor 180B may be further used in anavigation scenario and a motion-sensing game scenario.

The barometric pressure sensor 180C is configured to measure barometricpressure. In some embodiments, the electronic device 100 calculates analtitude based on a barometric pressure value measured by the barometricpressure sensor 180C, to assist in positioning and navigation.

The magnetic sensor 180D includes a Hall effect sensor. The electronicdevice 100 may detect opening and closing of a flip cover by using themagnetic sensor 180D. In some embodiments, when the electronic device100 is a clamshell phone, the electronic device 100 may detect openingand closing of a flip cover by using the magnetic sensor 180D. Further,a feature such as automatic unlocking upon opening of the flip cover isset based on a detected opening or closing state of the leather case ora detected opening or closing state of the flip cover.

The acceleration sensor 180E may detect magnitude of accelerations invarious directions (usually on three axes) of the electronic device 100,and may detect a magnitude and a direction of gravity when theelectronic device 100 is still. The acceleration sensor 180E may befurther configured to recognize a posture of the electronic device, andis used in screen switching between a landscape mode and a portraitmode, a pedometer, or another application.

The distance sensor 180F is configured to measure a distance. Theelectronic device 100 may measure the distance in an infrared or a lasermanner. In some embodiments, in a shooting scenario, the electronicdevice 100 may measure a distance by using the distance sensor 180F toimplement quick focusing.

The optical proximity sensor 180G may include, for example, alight-emitting diode (LED) and an optical detector, for example, aphotodiode. The light-emitting diode may be an infrared light-emittingdiode. The electronic device 100 emits infrared light by using thelight-emitting diode. The electronic device 100 detects infraredreflected light from a nearby object by using the photodiode. Whensufficient reflected light is detected, the electronic device 100 maydetermine that there is an object near the electronic device 100. Wheninsufficient reflected light is detected, the electronic device 100 maydetermine that there is no object near the electronic device 100. Theelectronic device 100 may detect, by using the optical proximity sensor180G, that the user holds the electronic device 100 close to an ear fora call, to automatically turn off a screen for power saving. The opticalproximity sensor 180G may also be used in a leather case mode or apocket mode to automatically unlock or lock the screen.

The ambient light sensor 180L is configured to sense ambient lightbrightness. The electronic device 100 may adaptively adjust brightnessof the display 194 based on the sensed ambient light brightness. Theambient light sensor 180L may also be configured to automatically adjusta white balance during shooting. The ambient light sensor 180L mayfurther cooperate with the optical proximity sensor 180G to detectwhether the electronic device 100 is in a pocket, to prevent anaccidental touch.

The fingerprint sensor 180H is configured to collect a fingerprint. Theelectronic device 100 may use a feature of the collected fingerprint toimplement fingerprint-based unlocking, application lock access,fingerprint-based shooting, fingerprint-based call answering, and thelike.

The temperature sensor 180J is configured to detect a temperature. Insome embodiments, the electronic device 100 executes a temperatureprocessing policy based on the temperature detected by the temperaturesensor 180J. For example, when the temperature reported by thetemperature sensor 180J exceeds a threshold, the electronic device 100lowers performance of a processor located near the temperature sensor180J, to reduce power consumption to implement thermal protection. Insome other embodiments, when the temperature is less than anotherthreshold, the electronic device 100 heats the battery 142 to preventthe electronic device 100 from being shut down abnormally due to a lowtemperature. In some other embodiments, when the temperature is lessthan still another threshold, the electronic device 100 boosts an outputvoltage of the battery 142, to avoid abnormal shutdown due to a lowtemperature.

The touch sensor 180K is also referred to as a “touch control device”.The touch sensor 180K may be disposed on the display 194, and the touchsensor 180K and the display 194 constitute a touchscreen, which is alsoreferred to as a “touch screen”. The touch sensor 180K is configured todetect a touch operation performed on or near the touch sensor 180K. Thetouch sensor may transfer the detected touch operation to theapplication processor, to determine a type of a touch event. Visualoutput related to the touch operation may be provided on the display194. In some other embodiments, the touch sensor 180K may alternativelybe disposed on a surface of the electronic device 100 at a positiondifferent from that of the display 194.

The bone conduction sensor 180M may obtain a vibration signal. In someembodiments, the bone conduction sensor 180M may obtain a vibrationsignal of a vibration bone of a human vocal-cord part. The boneconduction sensor 180M may also be in contact with a human pulse, toreceive a blood pressure beating signal. In some embodiments, the boneconduction sensor 180M may alternatively be disposed in a headset toform a bone conduction headset. The audio module 170 may obtain a voicesignal through parsing based on the vibration signal of the vibrationbone of the vocal-cord part obtained by the bone conduction sensor 180M,to implement a voice function. The application processor may parse heartrate information based on the blood pressure beating signal obtained bythe bone conduction sensor 180M, to implement a heart rate detectionfunction.

The motion sensor 180N may be configured to: detect a moving objectwithin a shooting range of a camera, and collect a moving contour, amoving track, or the like of the moving object. For example, the motionsensor 180N may be an infrared sensor, a laser sensor, or a dynamicvision sensor (DVS). The DVS may specifically include a sensor such as adynamic and active-pixel vision sensor (Davis), an asynchronoustime-based image sensor (ATIS), or a CeleX sensor. The DVS draws on acharacteristic of biological vision. Each pixel simulates one neuron andindependently responds to a relative change in light intensity (“lightintensity” for short hereinafter). When the relative change in the lightintensity exceeds a threshold, a pixel outputs an event signal, wherethe event signal includes a location of the pixel, a time stamp, andfeature information of the light intensity.

The button 190 includes a power button, a volume button, and the like.The button 190 may be a mechanical button, or may be a touch button. Theelectronic device 100 may receive a button input, and generate a buttonsignal input related to a user setting and function control of theelectronic device 100.

The motor 191 may generate a vibration prompt. The motor 191 may beconfigured to produce an incoming call vibration prompt and a touchvibration feedback. For example, touch operations performed on differentapplications (for example, shooting and audio playing) may correspond todifferent vibration feedback effects. The motor 191 may also correspondto different vibration feedback effects for touch operations performedon different areas of the display 194. Different application scenarios(for example, a time reminder, information receiving, an alarm clock,and a game) may also correspond to different vibration feedback effects.A touch vibration feedback effect may be further customized.

The indicator 192 may be an indicator light, and may be configured toindicate a charging status and a power change, or may be configured toindicate a message, a missed call, a notification, and the like.

The SIM card interface 195 is configured to connect to a SIM card. TheSIM card may be inserted into the SIM card interface 195 or removed fromthe SIM card interface 195, to implement contact with or separation fromthe electronic device 100. The electronic device 100 may support one orN SIM card interfaces, where N is a positive integer greater than 1. TheSIM card interface 195 can support a nano-SIM card, a micro-SIM card, aSIM card, and the like. A plurality of cards may be simultaneouslyinserted into a same SIM card interface 195. The plurality of cards maybe of a same type or of different types. The SIM card interface 195 maybe compatible with different types of SIM cards. The SIM card interface195 may also be compatible with an external storage card. The electronicdevice 100 interacts with a network through the SIM card, to implementfunctions such as calling and data communication. In some embodiments,the electronic device 100 uses an eSIM, namely, an embedded SIM card.The eSIM card may be embedded into the electronic device 100, and cannotbe separated from the electronic device 100.

It should be noted that, in some actual application scenarios, theelectronic device may include more or fewer components than those shownin FIG. 2. Specifically, a component quantity may be adjusted based onan actual application scenario. This is not limited in this disclosure.

The foregoing provides an example description for a hardware structureof the electronic device provided in this disclosure. A system that maybe loaded on the electronic device may include iOS®, Android®,Microsoft®, Linux®, HarmonyOS, another operating system, or the like.This is not limited in this embodiment of this disclosure.

An electronic device 200 on which an Android® operating system is loadedis used as an example. As shown in FIG. 3, the electronic device 200 maybe logically divided into a hardware layer 21, an operating system 261,and an application layer 31. The hardware layer 21 includes hardwareresources such as an application processor 201, a microcontroller unit203, a modem 207, a Wi-Fi module 211, a sensor 214, and a localizationmodule 250. The application layer 31 includes one or more applications,for example, an application 263. The application 263 may be any type ofapplication such as a social application, an e-commerce application, ora browser, or may be an object searching APP, so as to perform thedevice searching method provided in this disclosure, to search for adevice that is lost by a user. The operating system 261 is used assoftware middleware between the hardware layer 21 and the applicationlayer 31, and is a computer program for managing and controllinghardware and software resources.

In an embodiment, the operating system 261 includes a kernel 23, ahardware abstraction layer (hardware abstraction layer, HAL) 25, libraryand runtime (libraries and runtime) 27, and a framework (framework) 29.The kernel 23 is configured to provide an underlying system componentand a service, for example, power management, memory management, threadmanagement, or a hardware driver. The hardware driver includes a Wi-Fidriver, a sensor driver, a positioning module driver, and the like. Thehardware abstraction layer 25 encapsulates a kernel driver, provides aninterface for the framework 29, and shields implementation details of alower layer. The hardware abstraction layer 25 runs in user space, andthe kernel driver runs in kernel space.

The library and runtime 27 is also referred to as a runtime library, andprovides a library file and an execution environment required by anexecutable program during running. The library and runtime 27 includesAndroid runtime (ART) 271, a library 273, and the like. The ART 271 is avirtual machine or a virtual machine instance that can convert bytecodeof an application into machine code. The library 273 is a programlibrary that provides support for the executable program during running,and includes a browser engine (for example, webkit), a script executionengine (for example, a JavaScript engine), a graphics processing engine,and the like.

The framework 29 is configured to provide various basic commoncomponents and services, such as window management and locationmanagement, for an application in the application layer 31. Theframework 29 may include a phone manager 291, a resource manager 293, alocation manager 295, and the like.

All functions of the components in the operating system 261 describedabove may be implemented by the application processor 201 by executingprograms stored in memory.

A person skilled in the art may understand that the electronic device200 may include fewer or more components than those shown in FIG. 3, andthe electronic device shown in FIG. 3 includes only components morerelated to a plurality of implementations disclosed in embodiments ofthis disclosure.

The following describes in detail a device searching method provided inthis disclosure based on the network architecture and the electronicdevice provided in FIG. 1 to FIG. 3.

First, FIG. 4 is a schematic flowchart of a device searching methodaccording to this disclosure. Details are described as follows.

401. A first device obtains location information of a second device.

The first device may learn of a location of the second device based onthe location information of the second device. There may be a pluralityof manners for the first device to obtain the location information ofthe second device. Specifically, for example, the first device may findthe location information of the second device from stored data, or mayreceive the location information sent by the second device afterestablishing a connection to the second device, or a third deviceforwards the location information to the first device after the seconddevice sends the location information to the third device.

For example, in some scenarios, there are electronic devices such as awristband, a mobile phone, a tablet computer, and a smart TV included ina home of a user. After a plurality of electronic devices access a samenetwork or establish a connection to each other, each electronic devicemay periodically send location information of the electronic device toanother electronic device in the same network or an electronic deviceconnected to the electronic device. For example, the wristband maytransmit location coordinates of the wristband to the tablet computer orthe mobile phone every 5 seconds, or send location coordinates of thewristband to all electronic devices in the same network every 5 seconds.

Specifically, for example, in a possible scenario, after the wristbandof the user at a corner of the home sends location information to thetablet computer once, the wristband of the user is powered off due to noremaining power. Then the user holds the mobile phone and enters thehome, and the mobile phone accesses a home local area network. In thiscase, if the user needs to search for a location of the wristband byusing the mobile phone, the tablet computer in the same local areanetwork may send the location of the wristband to the mobile phone.

402. The first device obtains a relative location between the seconddevice and the first device based on location information of the firstdevice and the location information of the second device.

After obtaining the location information of the first device and thelocation information of the second device, the first device maycalculate the relative location between the second device and the firstdevice. The relative location may include a direction, a distance, andthe like of the second device relative to the first device.

For example, the first device may read a location of the first device,receive the location of the second device, then establish a coordinatesystem by using the first device as a center, and calculate a differencebetween the location of the first device and the location of the seconddevice to obtain a location of the second device in the coordinatesystem, so as to obtain a location vector of the second device in thecoordinate system, to calculate the direction and the distance of thesecond device relative to the first device.

403. Determine whether the first device has a shooting function; and ifthe first device has the shooting function, perform step 404, or if thefirst device does not have the shooting function, perform step 408.

Step 403 is an optional step. For example, when determining the seconddevice that needs to be searched for, the first device may obtain adevice attribute of the first device. The device attribute may includebut is not limited to information such as an appearance, a type, or afunction of the first device. Therefore, when the second device thatneeds to be searched for is determined, whether the first device has theshooting function may be read.

For ease of understanding, it may be briefly understood that, whetherthe first device has the foregoing camera 193 may be determined. If thefirst device has the camera, whether the second device is within ashooting range of the first device may be further determined. In otherwords, step 404 is performed. If the first device does not have thecamera, prompting may be performed based on the relative locationbetween the second device and the first device, that is, a location, thedirection, or the like of the second device relative to the first devicemay be indicated. In other words, step 408 is performed.

404. Determine whether the second device is within the shooting range ofthe first device.

When it is determined that the second device has the shooting function,whether the second device is within the shooting range of the firstdevice may be determined based on the relative location between thesecond device and the first device. If the second device is within theshooting range of the first device, the first device may directly shoota first image that includes the second device. In other words, step 406is performed. If the second device is not within the shooting range ofthe first device, and the first device is movable, prompting may beperformed to move the first device toward the second device, so that thesecond device is within the shooting range of the first device.

For example, the shooting range may be shown in FIG. 5. The shootingrange of the camera is a preset range, and is related to an angle ofview a of the camera. Usually, a larger angle of view of the cameraindicates a larger shooting range, and a smaller angle of view indicatesa smaller shooting range.

405. The first device indicates to move the first device toward thesecond device.

When the second device is not within the shooting range of the firstdevice, and the first device is movable, it may be indicated to move thefirst device toward the second device, so that the second device iswithin the shooting range of the first device.

In this disclosure, that the first device is movable may be that theuser may move the first device, that is, the first device may move underaction of an external force provided by the user, or may be that thefirst device is a movable device, for example, a device having a movablecomponent, such as a movable robot or a vacuum cleaning robot. If thefirst device is a movable device, after it is determined that the seconddevice is not within the shooting range of the first device, the firstdevice moves in a direction of the second device, so that the seconddevice is within the shooting range of the first device.

In addition, when the first device moves, the relative location betweenthe second device and the first device may be updated in real time, andcontent of prompting information indicating to move the first device maybe updated in real time. For example, a direction in which or a distanceby which the first device moves toward the second device and that isdisplayed in a display interface may be updated in real time based onthe relative location updated in real time.

406. The first device shoots a first image.

If the second device is within the shooting range of the first device,the first device may turn on the camera to shoot the first image.

Usually, if the second device is not shielded, the first device mayperform image recognition on the first device to determine an area inwhich the second device is located in the first image, or if the seconddevice is shielded, the first device may determine, with reference tothe relative location between the first device and the second device, anarea in which the second device is located in the first image.

Optionally, if the first device performs image recognition to determinethe area in which the second device is located in the first image,before performing image recognition, the first device may obtain adevice attribute of the second device, such as a device type, anappearance, or a size of the second device, so that recognition can beperformed on the first image based on the device attribute of the seconddevice, to accurately recognize the area in which the second device islocated.

407. The first device highlights, in a display, an area in which thesecond device is located in the first image.

If the first device has a display or is connected to a display, afterthe first image is obtained and the area of the second device in thefirst image is determined, the area of the second device in the firstimage may be highlighted in the display.

Optionally, the first device may further display the entire first imageor a part of the first image in the display.

Specifically, on a basis of displaying the first image, the area inwhich the second device is located may be directly displayed in a formof a thermodynamic diagram, or the area in which the second device islocated may be labeled in the first image by using information such as alabeling box, an arrow, or text.

408. The first device performs prompting on the relative locationbetween the second device and the first device.

Prompting may be performed on the location of the second device relativeto the first device in a form of prompting information. For example, ifthe first device does not have the shooting function, prompting may beperformed on the relative location between the first device and thesecond device. Alternatively, for another example, if the first devicehas the shooting function, but the second device is not within theshooting range of the first device, and the first device is unmovable,prompting may be performed on the relative location between the firstdevice and the second device. For another example, if the second deviceis within the shooting range of the first device, on a basis ofhighlighting, in the display, the area in which the second device islocated in the first image, prompting may be further performed on therelative location between the second device and the first device, sothat the user can find the second device more accurately, therebyimproving user experience.

Specifically, the relative location may include a first distance of thesecond device relative to the first device, a first direction of thesecond device relative to the first device, or the like. Step 408 mayinclude: performing prompting on the first distance and/or the firstdirection.

A more specific prompting manner may include but is not limited to:directly displaying the first distance and/or the first direction in thedisplay interface, for example, displaying the first distance and/or thefirst direction in a form such as text or an arrow; or playing voiceguidance, where the voice guidance includes a voice corresponding to thefirst distance and/or the first direction.

For example, text information, for example, “your wristband is 5 metersto the right”, may be displayed in the display interface, or the textmay be directly converted into a voice, so that the user can find thewristband based on voice prompting.

Therefore, in this implementation of this disclosure, in a devicesearching process, the relative location between the first device andthe second device may be obtained. If the first device has the shootingfunction, and the second device is within the shooting range of thefirst device, an area in which the second device is located may belabeled in a shot image, so that the user can intuitively view thelocation of the second device. In this way, the user can quickly find alost device, thereby improving user experience. If the first device hasthe shooting function, and the second device is not within the shootingrange of the first device, prompting may be performed to move the firstdevice, so that the second device is within the shooting range of thefirst device, and an area in which the second device is located islabeled in the shot image. In this way, the user can intuitively viewthe location of the second device. In this way, the user can quicklyfind a lost device, thereby improving user experience. When the firstdevice does not have the shooting function, prompting may be directlyperformed on the direction and/or the distance of the second devicerelative to the first device, so that the user can quickly find the lostsecond device based on prompting, thereby improving user experience.

The foregoing describes in detail a procedure of the device searchingmethod provided in this disclosure. With reference to a graphical userinterface (graphical user interface, GUI) provided in this disclosureand a more specific application scenario, the following furtherdescribes the procedure of the device searching method provided in thisdisclosure.

First, a GUI provided in this disclosure is described. The GUI may beused in an electronic device. For the electronic device, refer torelated descriptions in FIG. 1 to FIG. 3. The electronic device mayinclude a display, a memory, and one or more processors. The one or moreprocessors are configured to execute one or more computer programsstored in the memory. As described in the steps of the device searchingmethod mentioned in FIG. 4, the GUI is configured to display the displayinterface in the device searching method by using the display.

The following describes in detail the GUI provided in this disclosure.

The GUI is configured to: display information about a to-be-searchedsecond device, for example, information such as an icon and a name ofthe second device, in the display; and highlight, based on an obtainedfirst image and in the display, an area in which the second device islocated in the first image, where the first image is obtained asfollows: in response to an operation on the second device, obtaininglocation information of the second device, and obtaining a relativelocation between the second device and the electronic device based onthe location information of the second device; and if it is determined,based on the relative location, that the second device is within ashooting range of the electronic device, shooting the first image. In apossible implementation, the GUI may be further configured to displaythe relative location in the display.

In a possible implementation, the relative location includes a firstdistance between the electronic device and the second device and a firstdirection of the second device relative to the electronic device. TheGUI is specifically configured to display at least one of the firstdistance and the first direction in the display.

In a possible implementation, if the second device is not within theshooting range of the electronic device, the GUI is further configuredto: display, in the display, prompting information indicating to movethe electronic device toward the second device, until the second deviceis within the shooting range of the electronic device.

In a possible implementation, if the one or more processors detect thatthe electronic device moves, the one or more processors update therelative location between the electronic device and the second devicebased on real-time location information of the electronic device, toobtain an updated relative location. The GUI is further configured todisplay the updated relative location in the display.

For example, an application scenario of the device searching method andthe GUI provided in this disclosure may be shown in FIG. 6A and FIG. 6B.Details are described as follows.

601. A device A and a device B are interconnected.

The device A may be understood as the foregoing second device, and thedevice B may be understood as the foregoing first device.

Specifically, a communication connection may be established between thedevice A and the device B in a manner such as UWB, Bluetooth, Zigbee, orNFC.

It should be understood that, in some possible scenarios, there may beno connection established between the device A and the device B, andstep 601 is an optional step.

602. The device A and the device B transmit localization information toeach other.

If a communication connection is established between the device A andthe device B, the device A and the device B may send the localizationinformation to each other through the established communicationconnection, so as to notify each other of respective locations.

For example, as shown in FIG. 7, the device A may be a wristband, thedevice B may be a mobile phone, and a UWB connection is establishedbetween the wristband and the mobile phone. The wristband may transmit alocation of the wristband to the mobile phone through the UWBconnection, so that the mobile phone learns of the location of thewristband. Optionally, the location of the wristband may be displayed ina display interface of the mobile phone, so that a user can intuitivelyobserve the location of the wristband in the display interface of themobile phone.

In addition, in some scenarios, there may be no connection establishedbetween the device A and the device B. In this case, the device B mayobtain location information of the device A by using another device. Forexample, in some scenarios, the device A may be a wristband, and thedevice B may be a mobile phone. As shown in FIG. 8, a UWB connection isestablished between the wristband and a smart TV. The wristband sendslocation information of the wristband to the smart TV through the UWBconnection. As shown in FIG. 9, the smart TV establishes a Wi-Ficonnection to the mobile phone, and the smart TV sends the locationinformation of the wristband to the mobile phone, so that the mobilephone learns of a location of the wristband. Specifically, for example,in some scenarios, the wristband at a corner of a home of the userestablishes a connection to the smart TV and sends the locationinformation of the wristband to the smart TV, and then the wristband ispowered off due to insufficient power. When the user holds the mobilephone and enters the home, the mobile phone may establish a connectionto the smart TV by using Wi-Fi, and the smart TV may send last locationinformation sent by the wristband to the mobile phone, so that themobile phone can also obtain the location information of the wristbandwhile the mobile phone does not establish a connection to the wristband.Subsequently, prompting may be performed on the location of thewristband based on the location information, so that the user can stillfind the wristband without establishing a connection between the mobilephone and the wristband, thereby improving user experience.

603. A user requests to search for the device A on the device B.

An order for performing step 603 and step 601 is not limited in thisdisclosure. Step 601 may be first performed, or step 603 may be firstperformed. In this disclosure, an example in which step 601 is firstperformed is merely used for description. This imposes no limitation.

Specifically, the user may perform an operation on the device B, toindicate the device B to search for the device A.

For example, a GUI is shown in FIG. 10. A device that accesses a samelocal area network, for example, a mobile phone, a wristband, a headset,or a stylus, may be displayed in a touchscreen of the device B, and theuser may perform a selection operation on the touchscreen to select adevice that needs to be searched for.

In some possible scenarios, the device B may not have a display, but mayhave a speaker, a microphone, and the like, so that the user can controlthe device B via voice to search for the device A. For example, thedevice B may be a smart Bluetooth sound box. After waking up theBluetooth sound box, the user may send a voice control instruction tothe Bluetooth sound box, for example, an instruction such as “searchingfor the wristband” or “searching for the mobile phone”, to control theBluetooth sound box to search for the device A.

604. The device B calculates a relative location of the device A.

After the device A that needs to be searched for is determined, therelative location between the device A and the device B is calculatedbased on obtained location information of the device A. For example, adirection, a distance, a height, or the like of the device A relative tothe device B is calculated.

For example, the relative location between the device A and the device Bmay be calculated by using various simultaneous localization and mapping(simultaneous localization and mapping, SLAM) algorithms.

For ease of understanding, a manner of calculating the relative locationmay be simply understood as follows: establishing a coordinate system byusing the device B as a center, calculating a difference between alocation of the device A and a location of the device B, and determininga coordinate vector of the device A in the coordinate system based onthe difference, to obtain the direction and the distance of the device Arelative to the device B.

It should be noted that, the following step 605 to step 616 areperformed by the device B.

605. Determine whether the device B has a shooting function; and if thedevice B does not have the shooting function, perform step 606, or ifthe device B has the shooting function, perform step 609.

Determining whether the device B has the shooting function isdetermining whether the device B has a camera. If the device B has acamera, whether the device A is within a field of view of the device Bmay be continuously determined. In other words, step 609 is performed.If the device B does not have a camera, prompting may be performed onthe location of the device A in another manner, for example, byperforming step 606.

It should be understood that, step 605 is an optional step. In somescenarios in which the device B has the shooting function, a determiningstep may not be performed, but a next step may be directly performed.

In addition, an order for performing step 605 and step 604 is notlimited in this disclosure. Step 604 may be first performed, step 605may be first performed, or step 604 and step 605 may be simultaneouslyperformed. Specifically, the order may be adjusted based on an actualapplication scenario. An example in which step 604 is first performed ismerely used herein for description. This imposes no limitation.

606. Determine whether the device B has a display function; and if thedevice B has the display function, perform step 607, or if the device Bdoes not have the display function, perform step 608.

When the device B does not have the shooting function, whether thedevice B has the display function may be continuously determined. To bespecific, whether the device B has or is connected to a display may bedetermined. If the device B does not have the display function,prompting may be performed on the relative location between the device Aand the device B in a voice prompting manner. In other words, step 608is performed. If the device B has the display function, a display manneror a voice prompting manner may be selected to perform prompting on therelative location between the device A and the device B.

607. Display a location and direction illustration.

Specifically, the location and direction illustration may be displayedin the display of the device B or the display connected to the device B.The location and direction illustration is used to indicate a locationof the device A relative to the device B, for example, a distancebetween the device A and the device B and the direction of the device Arelative to the device B.

For example, a GUI is shown in FIG. 11. The direction of the device Arelative to the device B may be indicated in an arrow form in a displayinterface of the device B, and the distance between the device A and thedevice B is indicated in a text form. For another example, a GUI isshown in FIG. 12. The direction of the device A relative to the device Bmay be indicated in an arrow form in a display interface of the deviceB, and prompting is performed, by using text, on a distance that theuser moves toward the direction.

For another example, the device B may be a wristband, and a GUI is shownin FIG. 13A. A direction of the device A relative to the wristband maybe indicated in a watch face form in the wristband, and a distancebetween the device A and the wristband is displayed as 2.7 meters in atext form. For another example, a GUI is shown in FIG. 13B. The device Bmay be a smart TV, and prompting may be performed in the smart TV byusing “your ‘wristband’ is 3 meters to the right”, to indicate the userto find the wristband 3 meters to the right of the smart TV.

608. Perform voice prompting.

When the device B does not have the shooting function and does not havethe display, voice prompting may be performed on the location and thedirection of the device A relative to the device B, or when the userchooses to perform voice prompting, voice prompting may be performed onthe location and the direction of the device A relative to the device B.Therefore, even in a scenario in which the device B cannot performshooting and cannot perform displaying, voice prompting may also beperformed on the location of the device A, so that the user can quicklyfind the device A via voice, thereby improving user experience.

For example, as shown in FIG. 14, the device B may be a Bluetooth soundbox. The Bluetooth sound box may play a voice, to indicate, in a voiceform, a distance, a direction, or the like of a device that needs to besearched for relative to the Bluetooth sound box.

609. Determine whether the device A is within a field of view of thedevice B; and if the device A is within the field of view of the deviceB, perform step 610, or if the device A is not within the field of viewof the device B, perform step 613.

Specifically, when it is determined that the device B has the shootingfunction, whether the device A is within the field of view (namely, theshooting range) of the device B may be determined based on the relativelocation between the device A and the device B; and if the device A iswithin the field of view of the device B, the device B may shoot animage, or if the device A is not within the field of view of the deviceB, prompting may be performed to move the device B, so that the device Ais within the field of view of the device B.

For example, the device B is a mobile phone. As shown in FIG. 15, themobile phone establishes a coordinate system by using the mobile phoneas a center, and an origin of the coordinate system is a geometriccenter of the mobile phone. A Z-axis of the coordinate system isperpendicular to a screen of the mobile phone and points to a back sideof the mobile phone, a Y-axis of the coordinate system is parallel to along edge of the mobile phone, and an X-axis of the coordinate system isparallel to a short edge of the mobile phone. A shooting system of thedevice B, for example, a rear camera, is located at a location in whicha value of the X-axis and a value of the Y-axis are negative, and thecamera has a fixed field of view, for example, a horizontal field ofview is 120° and a vertical field of view is 90°. An optical axis of thecamera is parallel to the Z-axis of the coordinate system; a horizontaldirection of the camera is parallel to the X-axis of the coordinatesystem and is perpendicular to the Y-axis; and a vertical direction ofthe camera is parallel to the Y-axis of the coordinate system, and isperpendicular to the X-axis.

A location of the device A in the coordinate system of the device B is(X1, Y1, Z1), and a location of the device Ain a coordinate system ofthe camera of the device B is calculated as (X3, Y3, Z3) based on adifference (X2, Y2, Z2) between the origin of the coordinate system ofthe device B and a location of the camera of the device B. X3=X1+X2,Y3=Y1+Y2, and Z3=Z1+Z2. A horizontal angle of the device A in the cameraof the device B is arctan(X3/Z3), and a vertical angle of the device Ain the camera of the device B is arctan(Y3/Z3). If the horizontal angleof the device A is greater than the horizontal field of view/2, namely,|arctan(X3/Z3)|>(120°/2), or the vertical angle of the device A isgreater than the vertical field of view/2, namely,|arctan(Y3/Z3)|>(90°/2), the device A is outside the field of view ofthe device B.

610. Shoot an image.

When it is determined that the device A is within the field of view ofthe device B, the device B may turn on the camera to shoot an image. Theimage includes an area in which the device A is located.

611. Recognize a location of the device A in the image.

After the image including the area in which the device A is located isshot, the area of the device A in the image may be recognized throughimage recognition.

In a possible implementation, the device A included in the image may berecognized by using an algorithm such as canny edge detection, a deeplearning detection algorithm, or a support vector machine (SVM), so asto obtain the area of the device A in the image.

In another possible implementation, the area of the device A in theimage may be determined based on the relative location between thedevice A and the device B. That is, the relative location between thedevice A and the device B is directly converted into a coordinate in theimage. For example, in some scenarios, the device A may be shielded byan object, and the device A cannot be recognized in a shot image. Inthis case, the location of the device A may be calibrated into thecoordinate system of the camera with reference to the location of thedevice A relative to the device B, and a location of the device A in thecoordinate system of the camera is projected to a location in the image,to determine the area of the device A in the image.

In another possible implementation, the location of the device A in theimage may be determined with reference to the relative location betweenthe device A and the device B and image recognition.

Specifically, after the location of the device A in the image iscalculated by using the relative location between the device A and thedevice B, a partial area including the device A is captured from theimage for image recognition, so as to determine the area of the device Ain the image shot by the device B.

For example, after the distance and the direction of the device Arelative to the device B are learned of, if the device B has a camera,location coordinates of the device A need to be calibrated into acoordinate system of the camera. Then, a location of the device A in thecoordinate system of the camera is converted into a location in thecoordinate system of the image. For example, a conversion manner mayinclude:

${{Z_{c}\begin{bmatrix}u \\v \\1\end{bmatrix}} = {{{\begin{bmatrix}\frac{1}{dx} & 0 & u_{0} \\0 & \frac{1}{dy} & v_{0} \\0 & 0 & 1\end{bmatrix}\begin{bmatrix}f & 0 & 0 & 0 \\0 & f & 0 & 0 \\0 & 0 & 1 & 0\end{bmatrix}}\begin{bmatrix}R & T \\\overset{\rightarrow}{0} & 0\end{bmatrix}}\begin{bmatrix}X_{w} \\Y_{w} \\Z_{w} \\1\end{bmatrix}}},$

where Z_(c) represents a distance from a shot object to the camera, urepresents a horizontal coordinate of the shot object in the image, vrepresents a longitudinal coordinate of the shot object in the image, dxand dy are sizes of a horizontal pixel and a longitudinal pixel of thecamera, u₀ and v₀ are horizontal and longitudinal centers of the image,f is a focal length of the camera, R is a 3×3 matrix and represents arotation matrix between a coordinate system of a localization system andthe coordinate system of the camera, T is a 3×1 matrix and represents atranslation matrix between the coordinate system of the localizationsystem and the coordinate system of the camera, and X_(w), Y_(w), andZ_(w) represent a location of the device A.

After the location of the device A in the image is learned of, a partialimage is captured with this location as a center, to recognize thedevice A, thereby reducing calculation required for global detection ofthe image.

612. Highlight the location of the device A in the image.

After the area in which the device A is located in the image isdetermined, the area may be highlighted to prompt the user of the areaof the device A in the image, so that the user can determine, based onthe area highlighted in the image, a location in which the device A islocated in an actual scenario. In this way, the user can quickly findthe device A.

For example, a GUI is shown in FIG. 16A and FIG. 16B. After the area ofthe device A in the image is determined, the area of the device A in theimage may be highlighted in a form of a thermodynamic diagram. FIG. 16Ashows an image in which the device A is not shielded, where the area inwhich the device A is located is labeled in a form of a prompting box.FIG. 16B shows a thermodynamic diagram in which the device A isshielded, where an area in which the shielded device A is located islabeled by using a thermodynamic diagram. In addition, the area of thedevice A in the image may be further highlighted by using a promptingbox, text, an arrow, or the like, so that the user can intuitivelydetermine the location of the device A in the actual scenario by using ahighlighted area.

613. Determine whether the device B is movable; and if the device B isunmovable, perform step 614, or if the device B is movable, perform step615.

When it is determined that the device A is not within the field of viewof the device B, whether the device B is movable may be continuouslydetermined. If the device B is movable, the device B may be indicated tomove, the device B automatically moves, or the like. In other words,step 615 is performed. If the device B is unmovable, a location anddirection illustration may be directly displayed. In other words, step614 is performed.

Step 613 is an optional step, and the device B may directly learn ofwhether the device B is movable. For example, if the device B is a smartTV, a fixedly installed monitor, or the like, the device B is anunmovable device; or if the device B is a device that is not fixedlyinstalled, such as a mobile phone or a tablet computer, or is a devicethat has a movable component, such as a vacuum cleaning robot or a cargorobot, the device B is a device that can automatically move. When thedevice B is a movable device, prompting may be directly performed tomove the device B toward the device A or the device B may automaticallymove toward the device A. When the device B is unmovable, the locationand direction illustration may be directly displayed.

614. Display the location and direction illustration.

Step 614 is similar to step 607. For details, refer to relateddescriptions in step 607, and details are not described herein again.

615. Indicate a direction in which and a distance by which the device Bmoves toward the device A.

After it is determined that the device B is movable, the direction inwhich and the distance by which the device B moves toward the device Amay be displayed in the display, so that the user can move the device Btoward the device A based on content displayed in the display.

For example, a GUI is shown in FIG. 17. Prompting may be performed inthe display by using “5 meters to the right”, so that the device A iswithin a field of view of the device B.

In some possible scenarios, the device B may automatically move. When itis determined that the device A is not within the field of view of thedevice B, the device B may automatically move based on the direction andthe distance of the device A relative to the device B, so that thedevice A can be included in the field of view of the device B.

For example, a GUI is shown in FIG. 18A. The device B may be a vacuumcleaning robot with a display. The user may indicate the vacuum cleaningrobot via voice, a touchscreen, a button, or the like, to search for awireless headset. After the vacuum cleaning robot obtains locationinformation of the wireless headset, a direction and a distance of thewireless headset relative to the vacuum cleaning robot are calculated,to determine whether the wireless headset is within a field of view ofthe vacuum cleaning robot. If the wireless headset is not within thefield of view of the vacuum cleaning robot and is located on a rightside of the vacuum cleaning robot, the vacuum cleaning robot may move tothe right in this case, so that the wireless headset is within the fieldof view of the vacuum cleaning robot, as shown in FIG. 18B.

616. Update the relative location in real time.

When the device B moves toward the device A, if the device B detectsthat the device B moves, the device B may update a location of thedevice B in real time and calculate the location of the device Arelative to the device B in real time, and possibly, may further displaya change of the relative location in the display.

For example, a GUI is shown in FIG. 19 and FIG. 20. The device B may bea tablet computer. In FIG. 19, the user may be prompted to hold thetablet computer and move by 5 meters to the right. In a moving process,for example, after the user moves by 2 meters to the right, as shown inFIG. 20, “move by 3 meters to the right” is displayed in a display ofthe tablet computer, so that a to-be-searched device is within a fieldof view of the tablet computer.

Therefore, in this implementation of this disclosure, prompting may beperformed, in the device B, on the relative location between the deviceA and the device B, so that the user can quickly find the device A basedon the relative location, thereby improving user experience. If thedevice B has the shooting function and the display function, the area ofthe device A in the image may be highlighted in the display interface ofthe device B, so that the user can intuitively observe an actuallocation of the device A by using content highlighted in the image, toquickly find the device A.

The foregoing describes in detail the device searching method providedin this disclosure. With reference to the foregoing device searchingmethod, the following describes in detail a structure of an electronicdevice that performs the device searching method.

FIG. 21 is a schematic diagram of a structure of an electronic deviceaccording to this disclosure.

The electronic device includes: an obtaining module 2101, configured toobtain location information of a second device; a calculation module2102, configured to obtain a relative location between the second deviceand a first device based on location information of the electronicdevice and the location information of the second device; a shootingmodule 2103, configured to: if it is determined, based on the relativelocation, that the second device is within a shooting range of the firstdevice, shoot a first image; a determining module 2104, configured todetermine, by using the first device, an area in which the second deviceis located in the first image; and a prompting module 2105, configuredto highlight the area in which the second device is located in the firstimage.

In a possible implementation, the prompting module 2105 is furtherconfigured to display the entire first image or a part of the firstimage.

In a possible implementation, the prompting module 2105 is furtherconfigured to perform prompting based on the relative location betweenthe second device and the first device.

In a possible implementation, the relative location includes a firstdistance between the first device and the second device and a firstdirection of the second device relative to the first device. Theprompting module 2105 is specifically configured to perform, by usingthe first device, prompting on at least one of the first distance andthe first direction.

In a possible implementation, the prompting module 2105 is specificallyconfigured to: display at least one of the first distance and the firstdirection in a display interface; or play voice guidance, where thevoice guidance includes a voice of at least one of the first distanceand the first direction.

In a possible implementation, the prompting module 2105 is furtherconfigured to: if the second device is not within the shooting range ofthe first device, perform prompting to move the first device toward thesecond device, until the second device is within the shooting range ofthe first device.

In a possible implementation, the calculation module 2102 is furtherconfigured to: if it is detected that the electronic device moves,update the relative location between the first device and the seconddevice based on real-time location information of the electronic device,to obtain an updated relative location.

The prompting module 2105 is configured to indicate the updated relativelocation.

In a possible implementation, if the second device is within theshooting range of the first device, and the second device is shielded byan obstacle within the shooting range, the determining module 2104 isfurther configured to calculate, based on the relative location, an areain which the shielded second device is located in the first image.

The obtaining module 2101 is specifically configured to: establish acommunication connection, and receive the location information sent bythe second device.

In a possible implementation, the obtaining module 2101 is specificallyconfigured to: establish a communication connection to a third device;and receive the location information of the second device sent by thethird device, where the location information is sent to the third deviceby the second device.

In a possible implementation, the obtaining module 2101 is specificallyconfigured to: before the area in which the second device is located inthe first image is determined, obtain a device attribute of the seconddevice, where the device attribute includes a type or an appearance ofthe second device.

FIG. 22 is a schematic diagram of a structure of another electronicdevice according to this disclosure. Details are described as follows.

The electronic device may include a processor 2201, a memory 2202, and atransceiver 2203. The processor 2201 and the memory 2202 areinterconnected by using a line. The memory 2202 stores programinstructions and data.

The memory 2202 stores program instructions and data that correspond tothe steps in FIG. 4 to FIG. 20.

The processor 2201 is configured to perform the method steps performedby the first device or the electronic device shown in any embodiment inFIG. 4 to FIG. 20.

The transceiver 2203 is configured to perform the step of receiving orsending data that is performed by the first device or the electronicdevice shown in any embodiment in FIG. 4 to FIG. 20.

Optionally, the electronic device may further include a display 2204,configured to display the interface displayed by the first device or theelectronic device in FIG. 4 to FIG. 20.

Optionally, the electronic device may further include a speaker 2205,configured to play the voice played by the first device or theelectronic device in FIG. 4 to FIG. 20.

An embodiment of this disclosure further provides a computer-readablestorage medium. The computer-readable storage medium stores a programused to generate a vehicle travel speed. When the program runs on acomputer, the computer is enabled to perform the steps in the methodsdescribed in the embodiments shown in FIG. 4 to FIG. 20.

Optionally, the electronic device shown in FIG. 22 is a chip.

An embodiment of this disclosure further provides an electronic device.The electronic device may also be referred to as a digital processingchip or a chip. The chip includes a processing unit and a communicationinterface. The processing unit obtains program instructions through thecommunication interface. When the program instructions are executed bythe processing unit, the processing unit is configured to perform thesteps in the methods performed by the electronic device that are shownin any one of the foregoing embodiments in FIG. 4 to FIG. 10B.

An embodiment of this disclosure further provides a digital processingchip. A circuit and one or more interfaces that are configured toimplement the processor 2201 or a function of the processor 2201 areintegrated into the digital processing chip. When a memory is integratedinto the digital processing chip, the digital processing chip maycomplete the steps in the methods in any one or more of the foregoingembodiments. When a memory is not integrated into the digital processingchip, the digital processing chip may be connected to an external memorythrough a communication interface. The digital processing chipimplements, based on program code stored in the external memory, theactions performed by the electronic device in the foregoing embodiments.

An embodiment of this disclosure further provides a computer programproduct including instructions. When the computer program product runson a computer, the computer is enabled to perform the steps performed bythe electronic device in the methods described in the embodiments shownin FIG. 4 to FIG. 20.

The electronic device provided in embodiments of this disclosure may bespecifically a chip. The chip includes a processing unit and acommunication unit. The processing unit may be, for example, aprocessor. The communication unit may be, for example, an input/outputinterface, a pin, or a circuit. The processing unit may executecomputer-executable instructions stored in a storage unit, so that thechip in a server performs the device searching methods described in theembodiments shown in FIG. 4 to FIG. 20. Optionally, the storage unit isa storage unit in the chip, for example, a register or a cache; or thestorage unit may be a storage unit that is in the radio access deviceend and that is located outside the chip, for example, a read-onlymemory (ROM), another type of static storage device that can storestatic information and instructions, or a random-access memory (RAM).

Specifically, the processing unit or the processor may be a centralprocessing unit (CPU), a neural-network processing unit (NPU), agraphics processing unit (GPU), a digital signal processor (DSP), anapplication-specific integrated circuit (ASIC), a field-programmablegate array (FPGA), another programmable logic device, a discrete gate, atransistor logic device, a discrete hardware component, or the like. Thegeneral-purpose processor may be a microprocessor, or may be anyconventional processor, or the like.

For example, FIG. 23 is a schematic diagram of a structure of a chipaccording to an embodiment of this disclosure. The chip may berepresented as a neural-network processing unit NPU 230. The NPU 230 ismounted onto a host CPU as a coprocessor, and the host CPU allocates atask. A core part of the NPU is an operation circuit 2303. The operationcircuit 2303 is controlled by a controller 2304 to extract matrix datain a memory and perform a multiplication operation.

In some implementations, the operation circuit 2303 internally includesa plurality of processing engines (PEs). In some implementations, theoperation circuit 2303 is a two-dimensional systolic array. Theoperation circuit 2303 may alternatively be a one-dimensional systolicarray or another electronic circuit that can perform mathematicaloperations such as multiplication and addition. In some implementations,the operation circuit 2303 is a general-purpose matrix processor.

For example, it is assumed that there are an input matrix A, a weightmatrix B, and an output matrix C. The operation circuit 2303 fetchesdata corresponding to the matrix B from a weight memory 2302 and buffersthe data on each PE in the operation circuit. The operation circuit 2303fetches data of the matrix A from an input memory 2301, to perform amatrix operation with the matrix B to obtain a partial result or a finalresult of a matrix, and stores the result into an accumulator 2308.

The unified memory 2306 is configured to store input data and outputdata. The weight data is directly transferred to the weight memory 2302by using a direct memory access controller (DMAC) 2305. The input datais also transferred to the unified memory 2306 by using the DMAC 2305.

A bus interface unit (BIU) 2310 is configured to interact with the DMACand an instruction fetch buffer (IFB) 2309 through an AXI bus.

The bus interface unit (BIU) 2310 is used by the instruction fetchbuffer 2309 to obtain instructions from an external memory, and isfurther used by the direct memory access controller 2305 to obtain rawdata corresponding to the input matrix A or the weight matrix B from theexternal memory.

The DMAC 2305 is mainly configured to transfer input data in theexternal memory DDR to the unified memory 2306, transfer weight data tothe weight memory 2302, or transfer input data to the input memory 2301.

A vector calculation unit 2307 includes a plurality of operationprocessing units; and if necessary, performs further processing such asvector multiplication, vector addition, an exponential operation, alogarithmic operation, or value comparison on an output of the operationcircuit. The vector calculation unit 2307 is mainly configured toperform network calculation at a non-convolutional/fully connected layerin a neural network, for example, batch normalization (batchnormalization), pixel-level summation, and upsampling on a featureplane.

In some implementations, the vector calculation unit 2307 can store aprocessed output vector into the unified memory 2306. For example, thevector calculation unit 2307 may apply a linear function and/or anon-linear function to the output of the operation circuit 2303, forexample, perform linear interpolation on a feature plane extracted at aconvolutional layer, and for another example, accumulate vectors ofvalues to generate an activation value. In some implementations, thevector calculation unit 2307 generates a normalized value, a valueobtained through pixel-level summation, or a combination thereof. Insome implementations, the processed output vector can be used as anactivation input for the operation circuit 2303, for example, theprocessed output vector is used in a subsequent layer in the neuralnetwork.

The instruction fetch buffer 2309 connected to the controller 2304 isconfigured to store an instruction used by the controller 2304.

The unified memory 2306, the input memory 2301, the weight memory 2302,and the instruction fetch buffer 2309 all are on-chip memories. Theexternal memory is private to a hardware architecture of the NPU.

An operation at each layer in a recurrent neural network may beperformed by the operation circuit 2303 or the vector calculation unit2307.

The processor mentioned above may be a general-purpose centralprocessing unit, a microprocessor, an ASIC, or one or more integratedcircuits for controlling program execution of the methods in FIG. 4 toFIG. 20.

In addition, it should be noted that the described apparatus embodimentsare merely examples. The units described as separate parts may or maynot be physically separate, and parts displayed as units may or may notbe physical units, and may be located in one position, or may bedistributed on a plurality of network units. Some or all of the modulesmay be selected based on an actual requirement to achieve the objectivesof the solutions of embodiments. In addition, in the accompanyingdrawings of the apparatus embodiments provided in this disclosure,connection relationships between modules indicate that the modules havecommunication connections to each other, which may be specificallyimplemented as one or more communication buses or signal cables.

Based on the descriptions of the foregoing implementations, a personskilled in the art may clearly understand that this disclosure may beimplemented by software in addition to necessary universal hardware, orcertainly may be implemented by dedicated hardware, including adedicated integrated circuit, a dedicated CPU, a dedicated memory, adedicated component and part, and the like. Usually, all functionscompleted by a computer program may be easily implemented by usingcorresponding hardware, and a specific hardware structure used toimplement a same function may also be in various forms, for example, aform of an analog circuit, a digital circuit, or a dedicated circuit.However, in this disclosure, a software program implementation is abetter implementation in most cases. Based on such an understanding, thetechnical solutions of this disclosure may be implemented in a form of asoftware product. The computer software product is stored in a readablestorage medium, such as a floppy disk, a USB flash drive, a removablehard disk, a ROM, a RAM, a magnetic disk, or an optical disc of acomputer, and includes several instructions for instructing a computerdevice (which may be a personal computer, a server, a network device, orthe like) to perform the methods described in embodiments of thisdisclosure.

All or some of the foregoing embodiments may be implemented by usingsoftware, hardware, firmware, or any combination thereof. When softwareis used to implement embodiments, all or some of embodiments may beimplemented in a form of a computer program product.

The computer program product includes one or more computer instructions.When the computer program instructions are loaded and executed on thecomputer, the procedure or functions according to the embodiments ofthis disclosure are completely or partially generated. The computer maybe a general-purpose computer, a dedicated computer, a computer network,or another programmable apparatus. The computer instructions may bestored in a computer-readable storage medium or may be transmitted froma computer-readable storage medium to another computer-readable storagemedium. For example, the computer instructions may be transmitted from aweb site, computer, server, or data center to another website, computer,server, or data center in a wired (for example, a coaxial cable, anoptical fiber, or a digital subscriber line (DSL)) or wireless (forexample, infrared, radio, or microwave) manner. The computer-readablestorage medium may be any usable medium accessible by a computer, or adata storage device, such as a server or a data center, integrating oneor more usable media. The usable medium may be a magnetic medium (forexample, a floppy disk, a hard disk, or a magnetic tape), an opticalmedium (for example, DVD), a semiconductor medium (for example, asolid-state disk (SSD)), or the like.

In the specification, claims, and accompanying drawings of thisdisclosure, the terms “first”, “second”, “third”, “fourth”, and the like(if existent) are intended to distinguish between similar objects but donot necessarily indicate a specific order or sequence. It should beunderstood that the data termed in such a way are interchangeable in anappropriate circumstance, so that the embodiments described herein canbe implemented in an order other than the order illustrated or describedherein. Moreover, terms “include”, “comprise”, and any other variantsmean to cover non-exclusive inclusion, for example, a process, method,system, product, or device that includes a list of steps or units is notnecessarily limited to those steps or units, but may include other stepsor units not expressly listed or inherent to such a process, method,product, or device.

Finally, it should be noted that the foregoing descriptions are merelyspecific implementations of this disclosure, but are not intended tolimit the protection scope of this disclosure. Any variation orreplacement readily figured out by a person skilled in the art withinthe technical scope disclosed in this disclosure shall fall within theprotection scope of this disclosure. Therefore, the protection scope ofthis disclosure shall be subject to the protection scope of the claims.

What is claimed is:
 1. A device searching method implemented by a firstdevice, the device searching method comprising: obtaining first locationinformation of a second device; obtaining a relative location betweenthe second device and the first device based on second locationinformation of the first device and the first location information;determining, based on the relative location, whether the second deviceis within a shooting range of the first device; indicating, when thesecond device is not within the shooting range, to move the first devicetoward the second device until the second device is within the shootingrange; shooting, when the second device is within the shooting range, afirst image; determining an area in the first image in which the seconddevice is located; and highlighting the area.
 2. The device searchingmethod of claim 1, further comprising performing prompting based on therelative location.
 3. The device searching method of claim 2, whereinthe relative location comprises a first distance between the firstdevice and the second device and a first direction of the second devicerelative to the first device, and wherein performing the promptingcomprises performing the prompting according to at least one of thefirst distance or the first direction.
 4. The device searching method ofclaim 3, wherein performing the prompting further comprises: displayingat least one of the first distance or the first direction on a displayinterface; or playing voice guidance that comprises a voice indicatingat least one of the first distance or the first direction.
 5. The devicesearching method of claim 1, wherein after indicating to move the firstdevice toward the second device, the device searching method furthercomprises: detecting whether the first device has moved; updating, whenthe first device has moved, the relative location based on real-timelocation information of the first device; and indicating an updatedrelative location.
 6. The device searching method of claim 1, whereindetermining the area comprises: determining whether the second device isshielded by an obstacle within the shooting range; and calculating, whenthe second device is shielded by the obstacle within the shooting rangeand based on the relative location, the area.
 7. The device searchingmethod of claim 1, wherein obtaining the first location informationcomprises: establishing a communication connection to the second device;and receiving the first location information from the second device. 8.A first device, comprising: a camera; a transceiver configured to obtainfirst location information of a second device; a processor coupled tothe camera and the transceiver and configured to: obtain a relativelocation between the second device and the first device based on secondlocation information of the first device and the first locationinformation; determine, based on the relative location, whether thesecond device is within a shooting range of the camera; indicate, whenthe second device is not within the shooting range, to move the firstdevice toward the second device until the second device is within theshooting range; instruct, when the second device is within the shootingrange, the camera to shoot a first image; and determine an area in thefirst image in which the second device is located; and a display coupledto the processor and configured to highlight the area.
 9. The firstdevice of claim 8, wherein the processor is further configured toinstruct to perform prompting based on the relative location.
 10. Thefirst device of claim 9, wherein the relative location comprises a firstdistance between the first device and the second device and a firstdirection of the second device relative to the first device, and whereinthe processor is further configured to instruct to perform promptingaccording to at least one of the first distance or the first direction.11. The first device of claim 10, wherein the display is furtherconfigured to display at least one of the first distance or the firstdirection based on instruction from the processor, or wherein the firstdevice further comprises a speaker configured to play voice guidancebased on instruction from the processor and the voice guidance comprisesa voice indicating at least one of the first distance or the firstdirection.
 12. The first device of claim 8, wherein the display isfurther configured to display, based on instruction from the processor,prompting information indicating to move the first device toward thesecond device until the second device is within the shooting range, orwherein the first device further comprises a speaker configured to play,based on instruction from the processor, the prompting information untilthe second device is within the shooting range.
 13. The first device ofclaim 8, wherein the processor is further configured to: detect whetherthe first device has moved; and update, when the first device has moved,the relative location based on real-time location information of thefirst device to obtain an updated relative location, and wherein either:the display is further configured to display the updated relativelocation; or the first device further comprises a speaker configured toplay a voice indicating the updated relative location.
 14. The firstdevice of claim 8, wherein the processor is further configured to:determine whether the second device is shielded by an obstacle withinthe shooting range; and calculate, when the second device is shielded bythe obstacle within the shooting range and based on the relativelocation, the area.
 15. The first device of claim 8, wherein thetransceiver is further configured to: establish a communicationconnection to the second device; and receive the first locationinformation from the second device.
 16. A first device, comprising: adisplay; a memory configured to store instructions comprising code for agraphical user interface (GUI) of an application; and one or moreprocessors coupled to the display and the memory and configured toexecute the instructions to cause the first device to: display, usingthe display and in the GUI, information about a to-be-searched seconddevice; obtain first location information of the to-be-searched seconddevice; obtain a relative location between the to-be-searched seconddevice and the first device based on second location information of thefirst device and the first location information; determine, in responseto an operation on the to-be-searched second device and based on therelative location, whether the to-be-searched second device is within ashooting range of the first device; display, using the display and inthe GUI and when the to-be-searched second device is not within theshooting range, prompting information indicating to move the firstdevice toward the to-be-searched second device until the to-be-searchedsecond device is within the shooting range; shoot, when theto-be-searched second device is within the shooting range, a firstimage; and highlight, using the display and in the GUI, an area of thefirst image in which the to-be-searched second device is located. 17.The first device of claim 16, wherein the one or more processors arefurther configured to cause the first device to display, using thedisplay and in the GUI, the relative location.
 18. The first device ofclaim 17, wherein the relative location comprises a first distancebetween the first device and the to-be-searched second device and afirst direction of the to-be-searched second device relative to thefirst device, and wherein the one or more processors are furtherconfigured to cause the first device to display, using the display andin the GUI, at least one of the first distance or the first direction.19. The first device of claim 16, wherein the one or more processors arefurther configured to cause the first device to: detect whether thefirst device has moved; update, when the first device has moved, therelative location based on real-time location information of the firstdevice to obtain an updated relative location; and display, using thedisplay and in the GUI, the updated relative location.
 20. The firstdevice of claim 16, wherein the one or more processors are furtherconfigured to cause the first device to: determine whether theto-be-searched second device is shielded by an obstacle within theshooting range; calculate, based on the relative location and when theto-be-searched second device is shielded by the obstacle within theshooting range, the area; and highlight, using the display and in theGUI, the area.
 21. A computer-readable storage medium comprising aprogram, that when executed by one or more processors, causes a firstdevice to: obtain first location information of a second device; obtaina relative location between the second device and the first device basedon second location information of the first device and the firstlocation information; determine, based on the relative location, whetherthe second device is within a shooting range of the first device;indicate, when the first device determines that the second device is notwithin the shooting range, to move the first device toward the seconddevice until the second device is within the shooting range; shoot, whenthe second device is within the shooting range, a first image;determining an area in the first image in which the second device islocated; and highlight the area.